package com.jxl.mapper;

import com.github.pagehelper.Page;
import com.jxl.pojo.dto.AdminPageQueryDTO;
import com.jxl.pojo.entity.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface AdminMapper {
    /**
     * 根据id查询管理员信息
     * @param id
     * @return
     */
    @Select("select * from admins where admin_id = #{admin_id}")
    Admin getAdminById(Long id);

    /**
     * 分页查询管理员信息
     * @param adminPageQueryDTO
     * @return
     */
    Page<Admin> pageQuery(AdminPageQueryDTO adminPageQueryDTO);

    /**
     * 新增管理员信息
     * @param admin
     */
    @Insert("insert into admins(name,password_hash,email,phone,registration_date,account_updated_at,is_enabled) values(#{name},#{passwordHash},#{email},#{phone},#{registrationDate},#{accountUpdatedAt},#{isEnabled})")
    void  insert(Admin admin);

    /**
     * 修改管理员信息
     * @param admin
     */
    void update(Admin admin);
}
